#ifndef TCPTHREAD_H
#define TCPTHREAD_H

#include <QObject>
#include <QThread>
#include <QTcpSocket>
class Tcpthread : public QThread
{
    Q_OBJECT
public:
    Tcpthread(int sockDesc,QObject *parent = nullptr);
//    Tcpthread();
    ~Tcpthread();

protected:
    void run();
private slots:
    void recvData();
    void disconnectToHost();
public slots:
    void disconnectServer();
    void sendDataSlot(const QByteArray &data);

signals:
    void dataReady(const QString &data);//必须是const
    void disconnectTCP(int m_sockDesc);
    void connectTCP(QString clientIP,int m_sockDesc);

public:

private:
    int m_sockDesc;
    QTcpSocket *m_socket;

};

#endif // TCPTHREAD_H
